﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ViewModels
{
    /// <summary>
    /// 图书视图模型
    /// </summary>
    public class BookVM
    {
        public string BookID { get; set; }
        public string BookName { get; set; }
        public string ISBN { get; set; }
        public string Author { get; set; }
        public DateTime PublishDate { get; set; }
        public string BookVersion { get; set; }
        public int WordCount { get; set; }
        public int PageCount { get; set; }
        public string Publisher { get; set; }
        public decimal Price { get; set; }
        public BookClassesVM BookClassesVM { get; set; }
        public BookVM()
        {
            this.PublishDate = DateTime.Now;
            this.WordCount = this.PageCount = 0;
            this.Price = 0.00M;
        }
        public BookVM(BookVM vm)
        {
            this.BookID = vm.BookID;
            this.BookName = vm.BookName;
            this.ISBN = vm.ISBN;
            this.Author = vm.Author;
            this.PublishDate = vm.PublishDate;
            this.BookVersion = vm.BookVersion;
            this.WordCount = vm.WordCount;
            this.PageCount = vm.PageCount;
            this.Publisher = vm.Publisher;
            this.Price = vm.Price;
            if (vm.BookClassesVM != null)
            {
                this.BookClassesVM.ClassID = vm.BookClassesVM.ClassID;
                this.BookClassesVM.BookClass = vm.BookClassesVM.BookClass;
            }
        }
    }
}
